﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WindowsPhoneGameHungTrung
{
    public class GameManager
    {
        GamePlayScreen gamePlay;
        GameOverScreen gameOver;

        private static GameManager _instance = null;

        private GameManager()
        {
            gamePlay = new GamePlayScreen();
            gameOver = new GameOverScreen();
        }

        public static GameManager getInstance()
        {
            if(_instance == null)
                _instance = new GameManager();
            return _instance;
        }        

        public void LoadContent(ContentManager content)
        {
            gamePlay.LoadContent(content);
            gameOver.LoadContent(content);
        }

        public void Update(GameTime gameTime)
        {
            if( Global.IS_START_GAME == true)
                gamePlay.Update(gameTime);
            if (Global.IS_START_GAME == false)
            {
                gamePlay.ResetGame();
                gameOver.Update(gameTime);
            }
            
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            gamePlay.Draw(gameTime, spriteBatch);
            gameOver.Draw(gameTime, spriteBatch);
        }
    }
}
